package com.example.controller.utils;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice  //切面
public class ProjectExceptionAdvice {

    @ExceptionHandler(Exception.class)   //异常处理器,专门处理某一类异常
    public returnData doException(Exception e){
        e.printStackTrace();  //打印异常日志，方便调试
        return new returnData(false,"服务器故障，请稍后再试！");   //用于报异常后统一格式
    }
}
